package com.qys.livesMall.shop.controller.sys;

import com.qys.livesMall.common.result.R;
import com.qys.livesMall.shop.modal.dto.shop.advert.AddAdvert;
import com.qys.livesMall.shop.modal.dto.shop.advert.EditAdvert;
import com.qys.livesMall.shop.modal.vo.ShopAdvertInfoVO;
import com.qys.livesMall.shop.service.H2ShopAdvertInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 *
 * 后台管理-店铺轮播广告信息
 *
 *
 * @author
 * @since 2023-06-03
 */
@RestController
@RequestMapping("/web/shopAdvertInfo")
public class WebH2ShopAdvertInfoController {

    @Autowired
    private H2ShopAdvertInfoService shopAdvertInfoService;

    /**
     * 获取列表
     * @return
     */
    @GetMapping("/page/list/{shopId}")
    public R<List<ShopAdvertInfoVO>> list(@PathVariable("shopId") Long shopId){
        return R.ok(shopAdvertInfoService.getAdvertInfo(shopId));
    }

    /**
     * 新增
     * @param addAdvert
     * @return
     */
    @PostMapping
    public R add(@RequestBody AddAdvert addAdvert){
        return shopAdvertInfoService.add(addAdvert);
    }

    /**
     * 编辑
     * @param editAdvert
     * @return
     */
    @PutMapping()
    public R edit(@RequestBody EditAdvert editAdvert){
        return shopAdvertInfoService.edit(editAdvert);
    }

    /**
     * 删除
     * @param id
     * @return
     */
    @DeleteMapping("/{id}")
    public R del(@PathVariable Long id){
        return shopAdvertInfoService.del(id);
    }
}
